﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Theme="SkinFile"
 Inherits="Nivdal.SuspiciousTransfers" Codebehind="SuspiciousTransfers.aspx.cs"  %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" Runat="Server">
    <script type="text/javascript">
        function ChangeVisibility(DivName)
        {
            var display = document.getElementById(DivName).style.display;
            if(display == "none")
            {
                document.getElementById(DivName).style.display = "block";
            }
            else 
            {
                document.getElementById(DivName).style.display = "none"
            }
        }

        function doFocus(textboxname) {
            textboxname.className = 'modernTextboxFocus';
        }
        function doBlur(textboxname) {
            textboxname.className = 'modernTextbox';
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" Runat="Server">
    <asp:Label ID="PageNameTeamNameLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_PageName %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:UpdatePanel ID="ReportUpdatePanel" runat="server" UpdateMode="Conditional">

    <ContentTemplate>
        <asp:HiddenField ID="UserIdHF" runat="server" />
        <asp:HiddenField ID="LanguageHF" runat="server" />
        <asp:FormView ID="ReportFormView" runat="server" DataSourceID="ReportDataSourse" OnItemCommand="SubmitReportAction" Width="100%" DefaultMode="Edit">
        <ItemTemplate>No reports</ItemTemplate>
        <EditItemTemplate>
            <table cellpadding="5" style="width:100%;">
            <tr>
            <td style="vertical-align:top; width:40%;">
                <div class="basic_element">
                <div class="red_title">
                   <asp:Label ID="ReportInfoLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_ReportInfoTitleLabel %>" CssClass="white_title"></asp:Label>
                </div>
                <div class="padding5">

                
                    <asp:Label ID="PlayerTitleLabel" runat="server" Text="<%$ Resources:Resource, Global_Player %>" SkinID="InfoLabel"></asp:Label>
                    <asp:HyperLink ID="PlayerHyperlink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("PayerName") %>'
                     NavigateUrl='<%# "~/Player.aspx?Id=" + Eval("PlayerId") %>'></asp:HyperLink>
                    <br /><br />
                    <asp:Label ID="SellerTitleLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_SellerTitle %>" SkinID="InfoLabel"></asp:Label>
                    <asp:HyperLink ID="SellerHyperlink" runat="server" NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("SellerId") %>'
                     Text='<%# Eval("SelerName") %>' Visible='<%# Eval("SelerName").ToString().Length > 0 %>' SkinID="GreenTitleHyperLink" ></asp:HyperLink> 
                    <asp:HyperLink ID="SellerSuspLink" runat="server" NavigateUrl='<%# "~/ViewDuplicateConnections.aspx?UserId=" + Eval("SellerId") %>'
                      ImageUrl="~/Images/Icons/report.png" Visible='<%# Eval("SelerName").ToString().Length > 0 %>'></asp:HyperLink>
                    <asp:Label ID="NoSellerLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_YouthPlayerText %>" SkinID="GridLabel"
                     Visible='<%# Eval("SelerName").ToString().Length == 0 %>'></asp:Label>
                    <br /><br />
                    <asp:Label ID="Buyer1TitleLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_Buyer1Title %>" SkinID="InfoLabel"></asp:Label>
                    <asp:HyperLink ID="Buyer1Hyperlink" runat="server" Text='<%# Eval("Buyer1Name") %>' SkinID="GreenTitleHyperLink"
                     NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("Buyer1Id") %>'></asp:HyperLink>
                    <asp:HyperLink ID="Buyer1SuspLink" runat="server" NavigateUrl='<%# "~/ViewDuplicateConnections.aspx?UserId=" + Eval("Buyer1Id") %>'
                      ImageUrl="~/Images/Icons/report.png"></asp:HyperLink>
                    <br />
                    <asp:Label ID="Buyer1ConditionalBidLabel" runat="server" Text='<%# Eval("Buyer1ConditionalBid") %>' SkinID="GridLabel"></asp:Label>
                    <br /><br />
                    <asp:Label ID="Buyer2TitleLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_Buyer2Title %>" SkinID="InfoLabel"></asp:Label>
                    <asp:HyperLink ID="Buyer2Hyperlink" runat="server" Text='<%# Eval("Buyer2Name") %>' SkinID="GreenTitleHyperLink"
                     NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("Buyer2Id") %>' Visible='<%# Eval("Buyer2Name").ToString().Length > 0 %>'></asp:HyperLink>  
                    <asp:HyperLink ID="Buyer2SuspLink" runat="server" NavigateUrl='<%# "~/ViewDuplicateConnections.aspx?UserId=" + Eval("Buyer2Id") %>'
                      ImageUrl="~/Images/Icons/report.png"  Visible='<%# Eval("Buyer2Name").ToString().Length > 0 %>'></asp:HyperLink>
                    <asp:Label ID="NoBuyer2Label" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_FirstBidTitleLabel %>"
                    Visible='<%# Eval("Buyer2Name").ToString().Length == 0 %>' SkinID="GridLabel"></asp:Label>  

                    <br />
                    <asp:Label ID="Buyer2ConditionalBidLabel" runat="server" Text='<%# Eval("Buyer2ConditionalBid") %>' SkinID="GridLabel"></asp:Label>
                    <br /><br />
                    <asp:Panel ID="TransferDeadlinePanel" runat="server" Visible='<%# Eval("BidDeadine") != null %>'>                
                        <asp:Label ID="TransferDeadlineTitleLabel" runat="server"  
                        Text="<%$ Resources:Resource, CurrentBids_TransferDeadlineHeaderText %>" SkinID="InfoLabel"></asp:Label>      
                        <asp:Label ID="TransferDeadLineLabel" runat="server" Text='<%# Eval("BidDeadine") %>' SkinID="GridLabel"></asp:Label>
                        <br /><br />
                    </asp:Panel>
                    <asp:Panel ID="SB1IPConnectionPanel" runat="server" Visible='<%# Eval("SB1Connected") %>'>                
                        <asp:Label ID="SB1IPConnectionExistsLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_SellerBuyer1Connected %>"
                         SkinID="GridLabel"></asp:Label>
                         <br /><br />
                    </asp:Panel>
                    <asp:Panel ID="SB2IPConnectionPanel" runat="server" Visible='<%# Eval("SB2Connected") %>'>                
                        <asp:Label ID="SB2IPConnectionExistsLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_SellerBuyer2Connected %>"
                                     SkinID="GridLabel"></asp:Label>
                         <br /><br />
                    </asp:Panel>             
                    <asp:Panel ID="B1B2IPConnectionPanel" runat="server" Visible='<%# Eval("B1B2Connected") %>'>                
                        <asp:Label ID="B1B2IPConnectionExistsLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_Buyer1Buyer2Connected %>"
                         SkinID="GridLabel"></asp:Label>
                         <br /><br />
                    </asp:Panel> 
                    <asp:Label ID="TransferCompletedLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_TransferCompletedText %>"
                     Visible='<%# Eval("TransferExists") %>' SkinID="GridLabel"></asp:Label>   
                    <br />
                    <asp:Label ID="SumProblemDetected" runat="server" SkinID="GridLabel" Visible='<%# Eval("SubmitReasonSum") %>'
                    Text="<%$ Resources:Resource, SuspiciousReports_TransferSumTooHighText %>"></asp:Label>
                    <asp:Label ID="SumProblemNotDetected" runat="server" SkinID="GridLabel" Visible='<%# !(bool)Eval("SubmitReasonSum") %>'
                     Text="<%$ Resources:Resource, SuspiciousReports_TransferSumNormal %>"></asp:Label>
                    
                    <asp:UpdateProgress ID="ReportUpdateProgress" runat="server" AssociatedUpdatePanelID="ReportUpdatePanel">
                        <ProgressTemplate>
                            <div class="ajaxloader" >
                                <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loader.gif"/>
                            </div>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    
                    <br /><br />
                    <asp:Label ID="DecisionNote" runat="server" SkinID="InfoLabel" 
                     Text="<%$ Resources:Resource, SuspiciousReports_PleaseDescribeYourDecisionText %>"></asp:Label>
                    <br />
                    <CustomControls:TextArea ID="NoteTextBox" runat="server" TextMode="MultiLine" Rows="5" MaxLength="512" Width="90%" CssClass="modernTextbox"
                     onfocus="doFocus(this);" onblur="doBlur(this);"></CustomControls:TextArea>
                    <br /><br />
                    <asp:Button ID="SubmitButton" runat="server" Text="<%$ Resources:Resource, Global_Submit %>" 
                        CommandArgument='<%# Eval("ReportId") %>' CommandName="Submit"
                         message="<%$ Resources:Resource, SuspiciousReports_AreYouSureSubmitText %>" CssClass="GreenButtonTextStyle"
                         OnClientClick='return confirm(this.getAttribute("message"))' />
                    &nbsp;
                    <asp:Button ID="PostponeButton" runat="server" 
                     Text="<%$ Resources:Resource, SuspiciousReports_Postpone %>"
                     message="<%$ Resources:Resource, SuspiciousReports_AreYouSurepostponeText %>"
                     OnClientClick='return confirm(this.getAttribute("message"))'
                     CssClass="GreyButtonTextStyle" CommandName="Postpone"
                     CommandArgument='<%# Eval("ReportId") %>' />
                 </div>
                </div>
                
            </td>
            <td style="vertical-align:top; width:60%;">
                <div class="basic_element">
                <div class="red_title">
                   <asp:Label ID="BidsTitleLabel" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Master_BidsMenuText %>"></asp:Label>
                </div>
                <div class="padding5">
                    <asp:HiddenField ID="PlayerIdHiddenField" runat="server" Value='<%# Eval("PlayerId") %>' />
                
                    <asp:GridView ID="BidsGridview" runat="server" SkinID="Professional" AutoGenerateColumns="false" AllowPaging="true"
                     PageSize="5" DataSourceID="BidsDataSource" >
                        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
                            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
                        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
                        <Columns>
                            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Date %>" ItemStyle-Width="37%">
                                <ItemTemplate>
                                    <asp:Label ID="Date" runat="server" Text='<%# Eval("Date") %>' SkinID="GridLabel"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Team %>"  ItemStyle-Width="40%">
                                <ItemTemplate>
                                    <asp:HyperLink ID="TeamLink" runat="server" SkinID="GreenTitleHyperLink" 
                                    NavigateUrl='<%# "~/TeamHomePage.aspx?TeamId=" + Eval("TeamId") %>' Text='<%# Eval("TeamName") %>'></asp:HyperLink>
                                    <br />
                                    <asp:HyperLink ID="UserLink" runat="server" SkinID="GreenTitleHyperLink"
                                    NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("OwnerId") %>' Text='<%# Eval("OwnerName") %>' ></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="<%$ Resources:Resource, Player_OnBidButtonAreYouSurePart1 %>" ItemStyle-Width="23%">
                                <ItemTemplate>
                                    <asp:Label ID="BidSumLabel" runat="server" Text='<%# Eval("BidSum") %>' SkinID="GridLabel"></asp:Label>
                                    <asp:Label ID="AutoBidLabel" runat="server"  Visible='<%#  Eval("IsAutomaticBid") %>' SkinID="GridLabel"
                                     Text="(A)" ToolTip="<%$ Resources:Resource, CurrentBids_ConditionalBidHeaderText %>"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>                    
                    </asp:GridView>
                    <asp:SqlDataSource ID="BidsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                        SelectCommand="Nivdal_GetLatestBidsOnPlayer" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="PlayerIdHiddenField" PropertyName="Value" Type="Decimal" Size="12" Name="PlayerId"/>
                        </SelectParameters>
                    </asp:SqlDataSource>  
                    <br />
                    <asp:Label ID="ConditionalBidsTitleLabel" runat="server" SkinID="InfoLabel"
                    Text="<%$ Resources:Resource, CurrentBids_ConditionalBidHeaderText %>"></asp:Label> 
                    <br />
                    <asp:GridView ID="ConditionalBidsGridview" runat="server" SkinID="Professional" AutoGenerateColumns="false"
                     DataSourceID="ConditionalBidsDataSource" AllowPaging="false">
                        <Columns>
                            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Team %>">
                                <ItemTemplate>
                                    <asp:HyperLink ID="TeamHyperlink" runat="server" NavigateUrl='<%# "~/TeamHomePage.aspx?TeamId=" + Eval("TeamId") %>'
                                     SkinID="GreenTitleHyperLink" Text='<%# Eval("TeamName") %>'></asp:HyperLink>
                                     <br />
                                    <asp:HyperLink ID="UserHyperlink" runat="server" NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'
                                     SkinID="GreenTitleHyperLink" Text='<%# Eval("UserName") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:Label ID="BidLabel" runat="server" Text='<%# Eval("BidSum") %>' SkinID="GridLabel"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                            <asp:Label ID="NoConditionalBidsLabel" runat="server" SkinID="GridLabel"
                             Text="<%$ Resources:Resource, SuspiciousTransfer_NoConditionalBids %>"></asp:Label>
                        </EmptyDataTemplate>
                    </asp:GridView>

                    <asp:SqlDataSource ID="ConditionalBidsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                        SelectCommand="Nivdal_GetConditionalBidsOnPlayer" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="PlayerIdHiddenField" PropertyName="Value" Type="Decimal" Size="12" Name="PlayerId" />
                        </SelectParameters>
                    </asp:SqlDataSource>  
                    <br /><br />
                    <asp:Label ID="ActionsLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_PleaseChooseActionsText %>" SkinID="SmallHeaderLabel"></asp:Label>
                    <br />
                    <asp:CheckBox ID="DeleteConditionalBid1CheckBox" runat="server" Checked="false" CssClass="NewsItemStyle"
                    Text="<%$ Resources:Resource, SuspiciousReports_DeleteConditionalBid1 %>" Enabled='<%# Eval("Buyer1ConditionalBidExists") %>' />
                    <br />
                    <asp:CheckBox ID="DeleteConditionalBid2CheckBox" runat="server" Checked="false" CssClass="NewsItemStyle"
                    Text="<%$ Resources:Resource, SuspiciousReports_DeleteConditionalBid2 %>" Enabled='<%# Eval("Buyer2ConditionalBidExists") %>' />     
                    <br />
                    <asp:CheckBox ID="CancelTransferCheckBox" runat="server" Checked="false" CssClass="NewsItemStyle"
                     Text="<%$ Resources:Resource, SuspiciousReports_CancelTransferText %>" Enabled='<%# !((bool) Eval("TransferExists")) %>' />     
                    <br />
                    <asp:CheckBox ID="TakeTransferSumCheckBox" runat="server" Checked="false" CssClass="NewsItemStyle"
                     Text="<%$ Resources:Resource, SuspiciousReports_TakeMoneyFromSeller %>" Enabled='<%# Eval("TransferExists") %>' />
                    <br />
                    <asp:CheckBox ID="MarkSellerCheaterCheckBox" runat="server" CssClass="NewsItemStyle"
                    Text="<%$ Resources:Resource, SuspiciousReports_MarkSellerCheaterText %>" Enabled='<%# Eval("SellerExists") %>' />
                    <br />
                    <asp:CheckBox ID="MarkBuyer1CheaterCheckBox" runat="server" CssClass="NewsItemStyle"
                    Text="<%$ Resources:Resource, SuspiciousReports_MarkBuyer1CheaterText %>" />
                    <br />
                    <asp:CheckBox ID="MarkBuyer2CheaterCheckBox" runat="server" CssClass="NewsItemStyle"
                    Text="<%$ Resources:Resource, SuspiciousReports_MarkBuyer2CheaterText %>" Enabled='<%# Eval("Buyer2Exists") %>'/>                        
                    <br />
                    <asp:CheckBox ID="MessageToSellerCheckBox" runat="server" Enabled='<%# Eval("SellerExists") %>'
                     onclick="ChangeVisibility('SellerMessage')"
                     Text="<%$ Resources:Resource, SuspiciousReports_SendMessageToSellerText %>" CssClass="NewsItemStyle"  />
                    <div id="SellerMessage" style="display:none;">
                        <CustomControls:TextArea ID="MessageToSellerTextBox" runat="server" MaxLength="256" TextMode="MultiLine" Rows="3" Width="300"
                         Enabled='<%# Eval("SellerId") != null %>'></CustomControls:TextArea>
                    </div>
                    <br />
                    <asp:CheckBox ID="MessageToBuyer1CheckBox" runat="server" CssClass="NewsItemStyle"
                     onclick="ChangeVisibility('Buyer1Message')"
                     Text="<%$ Resources:Resource, SuspiciousReports_SendMessageToBuyer1Text %>" />
                    <div id="Buyer1Message" style="display:none;">
                        <CustomControls:TextArea ID="MessageToBuyer1TextBox" runat="server" MaxLength="256"
                         TextMode="MultiLine" Rows="3" Width="300"></CustomControls:TextArea>
                    </div>
                    <br />
                    <asp:CheckBox ID="MessageToBuyer2CheckBox" runat="server" Enabled='<%# Eval("Buyer2Exists") %>'
                    onclick="ChangeVisibility('Buyer2Message')"
                     Text="<%$ Resources:Resource, SuspiciousReports_SendMessageToBuyer2Text %>" CssClass="NewsItemStyle" />
                    <div id="Buyer2Message" style="display:none;">
                        <CustomControls:TextArea ID="MessageToBuyer2TextBox" runat="server" MaxLength="256" TextMode="MultiLine" Rows="3" Width="300"
                         Enabled='<%# Eval("Buyer2Id") != null %>'></CustomControls:TextArea>     
                    </div>
                </div>
                </div>
            </td>
            </tr>
            </table>
            
        </EditItemTemplate>
        <EmptyDataTemplate>
            <asp:Label ID="NoReportsLabel" runat="server" Text="<%$ Resources:Resource, SuspiciousReports_NoReportsText %>"
             SkinID="GridLabel"></asp:Label>
        </EmptyDataTemplate>
        </asp:FormView>   
    
        <asp:SqlDataSource ID="ReportDataSourse" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
         SelectCommand="Nivdal_GetTransferReportForGM" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="UserIdHF" Name="UserId" PropertyName="Value" />
            <asp:ControlParameter ControlID="LanguageHF" Name="Language" PropertyName="Value" />
        </SelectParameters>
        </asp:SqlDataSource>    
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>


 